package com.edu.internship.busi.controller;

import com.alibaba.fastjson.JSONObject;
import com.edu.internship.busi.service.IAttachmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * [一句话描述该类的功能]
 *
 * @author : [Acer]
 * @version : [v1.0]
 * @createTime : [2022/8/9 15:32]
 */
@RestController
@Slf4j
@RequestMapping("api/attach")
@Api(tags = {"文件的控制器"})
public class AttachmentController {

    @Resource
    IAttachmentService attachmentService;

    @PostMapping("upload-file")
    @ApiOperation(value = "上传附件",notes = "上传附件")
    public JSONObject uploadFileAttachment(@RequestParam("file") MultipartFile file, @RequestParam("fileSpace") String fileSpace){
        return attachmentService.uploadFileAttachment(file,fileSpace);
    }

}
